package vmcs.boundary.listener;

import vmcs.controller.MaintenanceController;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Title:        VMCS
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:      ISS
 * @author Pang Pingli
 * @version 1.0
 */

 import java.awt.*;
import vmcs.boundary.MessageDialog;

public class PriceDisplayListener implements ActionListener {
  private MaintenanceController  mctrl;

  public PriceDisplayListener(MaintenanceController  mc) {
    mctrl = mc;
  }
  public void actionPerformed(ActionEvent e) {
    /**@todo: Implement this java.awt.event.ActionListener method*/
    TextField  txt;

    String       sp;
    int          ip;
    try {
      txt = (TextField) e.getSource();
      sp = txt.getText();

      ip = Integer.parseInt(sp);
    } catch (NumberFormatException ee){
      MessageDialog ms = new MessageDialog(mctrl.getMaintenancePanel(), MessageDialog.NUMBER_FORMAT_ERROR);
      return;
    }
    mctrl.setPrice(ip);
  }
}